package 笔试.迅雷;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class 字符转换 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] split = in.nextLine().split(" ");
        String a = split[0];
        String b = split[1];
        int len = a.length();
        for (int i = 1; i < len; i++) {
            int difa = a.charAt(i) - a.charAt(i - 1);
            int difb = b.charAt(i) - b.charAt(i - 1);
            if ((difa == 0 && difb != 0) || (difa != 0 && difb == 0)) {
                System.out.println(false);
                return;
            }
        }
        System.out.println(true);
    }
}